//
//  FeedbackData.m
//  SHHCPhone
//
//  Created by Sheng long on 14-7-16.
//  Copyright (c) 2014年 sheng long. All rights reserved.
//

#import "FeedbackData.h"

@implementation FeedbackData

+(NSArray*)getMyFeedback
{
    NSMutableArray *array = [NSMutableArray arrayWithCapacity:1];
    
    [databasequeue inTransaction:^(FMDatabase *db, BOOL *rollback) {
        FMResultSet *rs = [db executeQuery:@"SELECT * FROM feedback WHERE userid = ?",APP_USER_MSG.id];
        if(rs != nil)
        {
            while([rs next])
            {
                [array addObject:[rs stringForColumn:@"msg"]];
            }
            [rs close];
        }
    }];
    return array;
}

+(BOOL)addMsg:(NSString*)msg
{
    __block BOOL s = NO;
    [databasequeue inTransaction:^(FMDatabase *db, BOOL *rollback) {
        s = [db executeUpdate:@"INSERT INTO feedback (userid,id,msg) VALUES (?,?,?)",APP_USER_MSG.id,msg];
    }];
    return s;
}

@end
